/* ebook/style.css */
/* 全局变量继承自global.css */

/* 顶部导航 */
.ebook-header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    flex: 1;
}

.logo-area h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-left: 15px;
}

.logo {
    height: 40px;
}

.search-area {
    flex: 3;
    display: flex;
    justify-content: center;
}

.search-box {
    width: 80%;
    max-width: 600px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.search-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--icon-color);
    cursor: pointer;
}

.search-btn:hover {
    color: var(--primary-color);
}

.user-area {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.user-avatar img:hover {
    transform: scale(1.1);
}

/* 分类导航 */
.category-nav {
    background: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.category-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: auto;
}

.category-list {
    display: flex;
    list-style: none;
    padding: 15px 0;
    white-space: nowrap;
}

.category-list li {
    margin-right: 25px;
}

.category-list a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s ease;
}

.category-list a:hover,
.category-list .active a {
    color: var(--primary-color);
}

.category-list .active a:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* 电子书展示区 */
.ebook-showcase {
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.showcase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.showcase-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.showcase-header h2 i {
    margin-right: 10px;
}

.view-more {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.view-more:hover {
    text-decoration: underline;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
}

.book-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.book-cover {
    position: relative;
    height: 0;
    padding-bottom: 140%;
    overflow: hidden;
}

.book-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.05);
}

.book-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.book-info {
    padding: 15px;
}

.book-title {
    font-size: 1rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-author {
    color: var(--icon-color);
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.book-category {
    color: var(--primary-color);
    background: rgba(67, 97, 238, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.book-rating {
    color: #ffc107;
}

/* 分页控制 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.page-btn {
    width: 40px;
    height: 40px;
    margin: 0 5px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover:not(.disabled):not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-ellipsis {
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: var(--icon-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
    }

    .logo-area,
    .search-area,
    .user-area {
        width: 100%;
        justify-content: center;
        margin-bottom: 15px;
    }

    .search-box {
        width: 100%;
    }

    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
